package com.qqtop10.manager.controller;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

import com.qqtop10.manager.model.Admin;
import com.qqtop10.manager.model.PagingArgs;
import com.qqtop10.manager.model.temp.BuildIndexCategoryTemp;
import com.qqtop10.manager.model.temp.BuildIndexGoodsTemp;
import com.qqtop10.manager.model.temp.FloorTempData;
import com.qqtop10.manager.model.temp.Goods;
import com.qqtop10.manager.service.CategoryService;
import com.qqtop10.manager.service.FloorService;
import com.qqtop10.manager.service.GoodsService;
import com.qqtop10.manager.service.ShopService;
import com.qqtop10.manager.service.UserService;
import com.qqtop10.manager.utils.UrlPath;

import freemarker.ext.beans.MapModel;

/**
 * @ClassName: ManagerController
 * @Description: 跳转控制器
 * @author ChenXinwei
 * @date 2015/9/17
 */
@RequestMapping("/manager/")
@Controller
public class ManagerController extends BaseController {

	@Autowired
	@Qualifier("shopService")
	private ShopService shopService;

	@Autowired
	@Qualifier("userService")
	private UserService userService;

	@Autowired
	@Qualifier("categoryService")
	private CategoryService categoryService;

	@Autowired
	@Qualifier("goodsService")
	private GoodsService goodsService;

	@Autowired
	@Qualifier("floorService")
	private FloorService floorService;
	

	@RequestMapping("index.do")
	public String index() {
		return "manager/index";
	}

	@RequestMapping("address.do")
	public String address() {
		return "manager/address";
	}

	@RequestMapping("shop.do")
	public String shop() {
		return "manager/shop";
	}

	@RequestMapping("shop-approve.do")
	public String shopApprove() {
		return "manager/shop-approve";
	}

	@RequestMapping("advertise.do")
	public String advertise() {
		return "manager/advertise";
	}

	@RequestMapping("order.do")
	public String order() {
		return "manager/order";
	}

	@RequestMapping("refund.do")
	public String refund() {
		return "manager/refund";
	}

	@RequestMapping("user.do")
	public String user() {
		return "manager/user";
	}

	@RequestMapping("brand.do")
	public String brand() {
		return "manager/brand";
	}

	@RequestMapping("test.do")
	public String test() {
		return "manager/test";
	}

	@RequestMapping("category.do")
	public String category() {
		return "manager/category";
	}

	@RequestMapping("system-info.do")
	public String systemInfo() {
		return "manager/systeminfo";

	}

	@RequestMapping("broadcast.do")
	public String broadcast() {
		return "manager/broadcast";
	}

	@RequestMapping("goods.do")
	public String goods() {
		return "manager/goods";
	}

	@RequestMapping("int_category.do")
	public String int_category() {
		return "manager/int_category";
	}

	@RequestMapping("industry_category.do")
	public String industry_category() {
		return "manager/industry_category";
	}

	@RequestMapping("delivery.do")
	public String delivery() {
		return "manager/delivery";
	}

	@RequestMapping("barCode.do")
	public String barCode() {
		return "manager/barCode";
	}

	@RequestMapping("statistical.do")
	public String statistical(HttpServletRequest request, HttpServletResponse response, ModelMap model) {
		return "manager/statistical";
	}

	@RequestMapping("statistical2.do")
	public String statistical2(HttpServletRequest request, HttpServletResponse response, ModelMap model) {
		return "manager/statistical2";
	}

	@RequestMapping("proprietary.do")
	public String proprietary(HttpServletRequest request, HttpServletResponse response, ModelMap model) {
		Admin admin = super.getLogind();
		model.put("user", userService.selectByUuid(admin.getUser_uuid()));
		model.put("shop", shopService.selectByUserUuid(admin.getUser_uuid()));
		model.put("home", UrlPath.HOME);
		return "manager/proprietary";
	}

	@RequestMapping("supplier.do")
	public String supplier(HttpServletRequest request, HttpServletResponse response, ModelMap model) {
		return "manager/supplier";
	}

	@RequestMapping("points.do")
	public String points(HttpServletRequest request, HttpServletResponse response, ModelMap model) {
		return "manager/points";
	}

	@RequestMapping("blacklist.do")
	public String blackList(HttpServletRequest request, HttpServletResponse response, ModelMap model) {
		return "manager/blackList";
	}

	@RequestMapping("coupon.do")
	public String coupon(HttpServletRequest request, HttpServletResponse response, ModelMap model) {
		return "manager/coupon";
	}

	@RequestMapping("couponDetails.do")
	public String couponDetails(HttpServletRequest request, HttpServletResponse response, ModelMap model) {
		return "manager/couponDetails";
	}

	@RequestMapping("rebatelink.do")
	public String rebatelink(HttpServletRequest request, HttpServletResponse response, ModelMap model) {
		return "manager/rebatelink";
	}

	@RequestMapping("rebate.do")
	public String rebate(HttpServletRequest request, HttpServletResponse response, ModelMap model) {
		return "manager/rebate";
	}

	@RequestMapping("adminuser.do")
	public String adminuser(HttpServletRequest request, HttpServletResponse response, ModelMap model) {
		return "manager/admin";
	}

	@RequestMapping("role.do")
	public String role(HttpServletRequest request, HttpServletResponse response, ModelMap model) {
		return "manager/role";
	}

	@RequestMapping("buildIndexPage.do")
	public String buildIndex(HttpServletRequest request, HttpServletResponse response, ModelMap modelMap) {
		// category
		List<BuildIndexCategoryTemp> categoryList = categoryService.buildIndexGetCategory();
		modelMap.addAttribute("category", categoryList);
		// goods
		List<BuildIndexGoodsTemp> goodsList = goodsService.selectBuildIndexPageGoods();
		modelMap.addAttribute("goods", goodsList);
		// 已有的首页数据
		List<FloorTempData> floorData = floorService.selectFloorAll();
		
		modelMap.addAttribute("floorData", floorData);
		return "manager/buildIndexPage";
	}

	@RequestMapping("searchKeyword.do")
	public String searchKeyword(HttpServletRequest request, HttpServletResponse response, ModelMap modelMap) {
		return "manager/searchKeyword";
	}

	@RequestMapping("groupBuy.do")
	public String groupBuy(HttpServletRequest request, HttpServletResponse response, ModelMap model) {
		return "manager/groupBuy";
	}

	@RequestMapping("categoryIcon.do")
	public String categoryIncon(HttpServletRequest request, HttpServletResponse response, ModelMap model) {
		return "manager/categoryIcon";
	}

	@RequestMapping("footerInfo.do")
	public String footerInfo(HttpServletRequest request, HttpServletResponse response, ModelMap model) {
		return "manager/footerInfo";
	}

	@RequestMapping("footerEdit.do")
	public String footerEdit(HttpServletRequest request, HttpServletResponse response, ModelMap model) {
		return "manager/footerEdit";
	}
	@RequestMapping("customerflow.do")
	public String coustomerflow(HttpServletRequest request,HttpServletResponse response,ModelMap moudel){
		return "manager/customerflow";
	}
	@RequestMapping("selectById.do")
	public String cousselectby(HttpServletRequest request,HttpServletResponse response,ModelMap moudel){
		return "manager/customerflow";
	}
	//提现
	@RequestMapping("withdrawal.do")
	public String withdrawal(HttpServletRequest request,HttpServletResponse response,ModelMap moudel){
		return "/manager/withdrawal";
	}
	//充值
	@RequestMapping("givevalue.do")
	public String givevalue(HttpServletRequest request,HttpServletResponse response,ModelMap moudel){
		return "/manager/givevalue";
	}
	//余额积分
	@RequestMapping("balance.do")
	public String balance(HttpServletRequest request,HttpServletResponse response,ModelMap moudel){
		return "/manager/balance1";
	}
	//订单查询
	@RequestMapping("labelling.do")
	public String labelling(HttpServletRequest request,HttpServletResponse response,ModelMap moudel){
		return "/manager/labelling";
	}
}
